/*
 *  SSChartView.h
 *  MESLib
 * 
 * Copyright 2003-2009 Starline Software Ltd
 * 
 * This file is part of MESLib.
 * 
 * MESLib is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * MESLib is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with MESLib. If not, see <http://www.gnu.org/licenses/>.
 */
//  Created by Tobias Haughton on Wed Jan 22 2003.
//

#import <AppKit/AppKit.h>
#import "SSConst.h"
#import "SSCatalystComment.h"
#import "SSCommentView.h"
#import "SSDateDisplayView.h"
#import "SSSelectionView.h"
#import "SSJumpMapView.h"
#import "SSOverlapDisplayGenerator.h"

@interface SSChartView : NSView {
   IBOutlet id dateDisplayView;
   IBOutlet id theDocument;
   IBOutlet id theTable;

   SSSelectionView *selectionView;
   NSBezierPath *temporaryLink;
   NSMutableArray *eventViewArray;
   NSMutableArray *commentViewArray;
   NSMutableArray *selectedObjects;
   int topIndexForRecalculation;
   NSPoint anchorPoint;
   NSPoint mousePosition;
   NSRect selectionRect;
   NSCursor *handCursor;
   BOOL displayingJumpMap;
   int ssDisplayMode;
   float overlapUnit;
   float overlapPixelsPerUnit;
   SSChartDate *overlapViewFromDate;
   SSOverlapDisplayGenerator *overlapDisplayGenerator;
   NSMutableDictionary *overlapDisplayData;
}


- (void)addEventView:(SSEventView *)view;
- (void)addCommentView:(SSCommentView *)view;
- (void)addJumpMapView:(SSJumpMapView *)view;

- (NSMutableArray *)eventViews;
- (NSMutableArray *)commentViews;

- (void)recalculateEBPositions;

- (BOOL)pointIsWithinRect:(NSPoint)point rect:(NSRect)rect;

- (void)setTemporaryLinkWithStartPoint:(NSPoint)start endPoint:(NSPoint)end;
- (void)removeTemporaryLinkPoints;
- (void)setLinkIfAboveAnotherEB:(SSEventView *)linkingView point:(NSPoint)point;

- (void)invalidateSelection;
- (void)invalidateSelectionForObject:(id)object;
- (void)markAsSelected:(id)s byAddingToSelection:(BOOL)add;
- (void)selectObjectsWithinSelectionRect;
- (void)setSelectionRect:(NSRect)rect;
- (NSRect)selectionRect;
- (void)setSelectedViewsDistanceFromOrigin:(NSPoint)point;
- (void)setSelectedViewsOriginWithPoint:(NSPoint)point;
- (NSMutableArray *)selectedObjects;
- (id)nonViewObjectAtPoint:(NSPoint)point;
- (void)selectAndDisplayObject:(id)object;
- (void)setSelectedEventDraggingMode:(int)mode;
- (void)updateSelectedEventDataAfterDrag;

- (void)setTheDocument:(id)doc;

- (void)sizeToFit;
- (void)sizeToEndDate:(NSCalendarDate *)endDate;
- (void)resizeIfSubviewOutOfBounds:(NSNotification *)note;

- (float)widthOfDateDisplayCells;

- (float)xPositionForDate:(NSCalendarDate *)date;
- (SSChartDate *)dateForXPosition:(float)xPos isEstimated:(BOOL)est;
- (void)datesForFrame:(NSRect)rect begin:(SSChartDate **)begin end:(SSChartDate **)end beginIsEstimated:(BOOL)beginEst endIsEstimated:(BOOL)endEst;
- (NSRect)frameForDates:(SSChartDate *)begin end:(SSChartDate *)end oldFrame:(NSRect)oldFrame;

- (float)overlapUnit;
- (void)setOverlapUnit:(float)unit;
- (float)overlapPixelsPerUnit;
- (void)setOverlapPixelsPerUnit:(float)pix;
- (SSChartDate *)overlapViewFromDate;
- (void)setOverlapViewFromDate:(SSChartDate *)date;
- (void)setOverlapViewFromDate;

- (int)displayMode;
- (void)setDisplayMode:(int)mode;

- (void)updateOverlapDisplayData;
- (NSMutableDictionary *)overlapDisplayData;

- (void)zoomOverlapIn;
- (void)zoomOverlapOut;

- (NSData *)pasteboardDataForObjects:(NSArray *)array;
@end
